{assign var="first" value=1}
{ext->tree_get_fields assign="elements" id=$data.page.id}

{if $smarty.get.element_type}
{assign var="element_type" value=$smarty.get.element_type}
{/if}

{if count($data.elements)>0}
{assign var="page_elements" value=""}
{foreach from=$data.elements key="key" item="el"}
{if !$element_type || ($element_type==$el.type|md5)}
{assign_array2 var=$page_elements key=$key value=$el assign="page_elements"}
{/if}
{/foreach}
{/if}

{ext->paging elements=$page_elements items_per_page=$_var.elemenents_per_page page=$smarty.get.element_list_page_nr assign="page_data"}
<table width="100%" cellpadding="0" cellspacing="0" style="border:1px solid #C4CDD2; border-top:0px; background:#DBE1E5; padding:0px 5px 5px 5px">
	<tr>
		<td>
		
		<table width="100%" cellpadding="0" cellspacing="0">
			<tr>
				<td height="10"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>		
			</tr>
			<tr>
				<td height="1" bgcolor="#ADB9BF"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
			</tr>
			<tr>
				<td height="1" bgcolor="#E4E9EC"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
			</tr>
			<tr>
				<td height="10"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>		
			</tr>
		</table>		
		<table width="100%" cellpadding="0" cellspacing="0">
			<tr>
				<td height="1" bgcolor="#C4CDD2"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>		
			</tr>			
		</table>
		<table width="100%" cellpadding="0" cellspacing="0" style="border:1px solid #C4CDD2; border-top:0px;">
			<tr>
				<td width="1" bgcolor="#DBE1E5"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
				<td style="border:5px solid white; border-bottom:0px">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td style="border:1px solid #8CA2B1">
{if $data.page.type=='secure_folder01'}
	{include file="admin/modules/client/body_for_tree.html"}
{else}
	{if ($smarty.get.tpl_action=="edit_content" || !$smarty.get.tpl_action) && !$elements}
	<table width="100%" cellpadding="0" cellspacing="0">
		<tr>
			<td height="50" bgcolor="#FFFFFF" align="center" style="padding:15px">
			{t t='Šis puslapis negali turėti turinio, nes jo tipas yra'} "{t t=$data.page.type}"
			</td>		
		</tr>
	</table>
	{elseif ($smarty.get.tpl_action=="edit_content" || !$has_elements || !$smarty.get.tpl_action) && $elements && $smarty.get.tpl_action!="show_comments" && $smarty.get.tpl_action!="edit_comments"}
	<form action="index.php" method="post" name="form{$data.page.id}" enctype="multipart/form-data">
	<input name="admin" type="hidden" value="1">
	<input name="body" type="hidden" value="{$smarty.session.body}">
	<input name="show_menu" type="hidden" value="{$smarty.get.show_menu}">
	<input name="mod" type="hidden" value="product">
	<input name="act" type="hidden" value="mod">
	<input name="id_type" type="hidden" value="{$data.page.type}">
	<input name="parent" type="hidden" value="{$data.page.id}">
	<input type="hidden" name="referer" value="{ext->get_referer}">
	{include file="admin/body/fields/selector.html"}
	</form>
	{elseif $smarty.get.tpl_action=="show_comments"}
	<form name="comments_list" action="index.php" enctype="multipart/form-data" method="post">
	<input name="admin" type="hidden" value="1">
	<input name="mod" type="hidden" value="comments">
	<input name="act" type="hidden" value="del_comment_mas">
	<table width="100%" cellpadding="0" cellspacing="0">
		<tr>
			<td style="padding:6px 6px 0px 6px ">{include file="admin/body/comments/menu.html"}</td>		
		</tr>
	</table>
	{include file="admin/body/comments/comments.htm"}	
	<table width="100%" cellpadding="0" cellspacing="0">
		<tr>
			<td style="padding:0px 6px 6px 6px ">{include file="admin/body/comments/menu.html"}</td>		
		</tr>
	</table>
	{elseif $smarty.get.tpl_action=="edit_comments"}
	<form name="form{$smarty.get.id}" action="index.php" enctype="multipart/form-data" method="post">
	<input name="admin" type="hidden" value="1">
	<input name="mod" type="hidden" value="comments">
	<input name="act" type="hidden" value="mod_comment">
	<input name="parent" type="hidden" value="{$data.page.id}">
	<input name="comment_nr" type="hidden" value="{$smarty.get.nr}">
	<input type="hidden" name="referer" value="{ext->get_referer}">
	{include file="admin/body/comments/editcomments.htm"}	
	{else}
	<form name="element_list" action="index.php" enctype="multipart/form-data" method="post">
	<input name="admin" type="hidden" value="1">
	<input name="copys" type="hidden" value="">
	<input name="parent" type="hidden" value="">
	<input name="mod" type="hidden" value="catalog">
	<input name="act" type="hidden" value="del_mas_undo">
	{if $has_elements}
	<table width="100%" cellpadding="0" cellspacing="0">
		<tr>
			<td style="padding:6px 6px 0px 6px ">{include file="admin/body/elements/menu.html"}</td>
		</tr>
	</table>
	{/if}
	
	{if $has_elements && !$page_elements}
	<table width="100%" cellpadding="0" cellspacing="0">
		<tr>
			<td width="7"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
			<td height="50" bgcolor="#FFFFFF" align="center" style="padding:15px">{t t='Šis puslapis neturi elementų. Sukurkite juos!'}</td>		
			<td width="7"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
		</tr>
	</table>
	{elseif !$has_elements && !$page_elements && $smarty.get.tpl_action!="show_comments"}
	<table width="100%" cellpadding="0" cellspacing="0">
		<tr>
			<td height="50" bgcolor="#FFFFFF" align="center" style="padding:15px">{t t='Šis puslapis negali turėti turinio, nes jo tipas yra'} "{t t=$data.page.type}"</td>		
		</tr>
	</table>
	{else}
		<div id="elements_id">
		{assign var="elements_list" value=$page_elements}
		{if $smarty.get.element_list_page_nr}{assign var="elements_page" value=$smarty.get.element_list_page_nr}{else}{assign var="elements_page" value=1}{/if}
		{if $data.page.type=='catalog'}
			{include file="admin/body/elements/catalog.htm"}
		{elseif $data.page.type=='images_galery01'}
			{include file="admin/body/elements/images_galery01.htm"}
		{elseif $data.page.type=='news_catalog'}
			{ext->aasort array=$page_elements args="-news_date_from" assign="elements_list"}
			{include file="admin/body/elements/news.htm"}
		{elseif $data.page.type=='tree_house01'}
			{include file="admin/body/elements/catalog.htm"}
		{elseif $data.page.type=='tree_houseblock01'}
			{include file="admin/body/elements/catalog.htm"}
		{elseif $data.page.type=='house_catalog01'}{
			include file="admin/body/elements/catalog.htm"}
		{elseif $data.page.type=='tree_faq_catalog01'}
			{include file="admin/body/elements/catalog.htm"}
		{else}
			{include file="admin/body/elements/catalog.htm"}
		{/if}
		</div>
	{/if}
	{if $has_elements}
	<table width="100%" cellpadding="0" cellspacing="0">
		<tr>
			<td style="padding:0px 6px 6px 6px ">{include file="admin/body/elements/menu.html"}</td>		
		</tr>
	</table>
	{/if}
	</form>
	{/if}
{/if}
</td>		
</tr>
</table>
				
				<table width="100%" cellpadding="0" cellspacing="0">
					<tr>
						<td bgcolor="#FFFFFF" height="5">						
						{if ($smarty.get.tpl_action=="edit_content" || $type_group || !$smarty.get.tpl_action || $smarty.get.tpl_action!="edit_comments") && $smarty.get.tpl_action!="show_comments" && $data.page.type!='secure_folder01' && $smarty.get.tpl_action!="show_elements"}<input onClick="doSubmit('form{$data.page.id}'); return false;" type="button" value="{t t='Išsaugoti pakeitimus'}" class="defaultFormButton" style="margin:10px ">{/if}
						</td>		
					</tr>
				</table>
				
				</td>	
				<td width="1" bgcolor="#DBE1E5"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
			</tr>
		</table>
		
		
		
		
		</td>		
	</tr>	
</table>


{if !$first}
<table width="100%" cellpadding="0" cellspacing="0">
	<tr>
		<td height="1" bgcolor="#DBE1E5"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
	</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
	<tr>
		<td height="20"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>		
	</tr>
</table>

{/if}

